package com.homework;

import java.util.Arrays;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/27 17:08
 * @description
 */
public class T5 {
    public static void main(String[] args) {
        String s = "To be or not to be";
        char[] chars = s.toCharArray();
        char[][] c6 = new char[6][chars.length];
        int i=0;
        for (int j = 0; j < chars.length;j++) {
                if (chars[j]==' '){
                    i++;
                    if (i==6){
                        return;
                    }
                }else {
                    c6[i][j] = chars[j];
                }
            }
        String[] s6 = new String[6];
        for (int x = 0; x < c6.length; x++) {
            s6[x] = String.valueOf(c6[x]).trim();
        }
//        System.out.println(Arrays.toString(s6));

        String reStr = "";
        for (int b = 0; b < s6.length; b++) {
            char[] chars1 = s6[b].toCharArray();
            for (int a = 0; a < chars1.length/2; a++) {
                char temp = chars1[a];
                chars1[a]=chars1[chars1.length-1-a];
                chars1[chars1.length-1-a] = temp;
            }
            reStr = reStr+" "+String.valueOf(chars1);
        }
        System.out.println("reStr = " + reStr);

    }
}
